package DataStructure.set.TreeSet;

import java.util.Set;
import java.util.TreeSet;

public class TreeSetTest2 {
    public static void main(String[] args) {
        //实例化TreeSet容器
        Set<User> set = new TreeSet<>();

        User user1 = new User("jing", 22);
        User user2 = new User("admin", 22);
        User user3 = new User("sxt", 22);
        User user4 = new User("jing", 22);

        set.add(user1);
        set.add(user2);
        set.add(user3);
        set.add(user4);

        for(User user : set){
            System.out.println(user);
        }
    }
}
